package com.jeethink.erp.commodity.service.impl;

import java.util.List;
import com.jeethink.common.utils.DateUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jeethink.erp.commodity.mapper.TbCommodityMapper;
import com.jeethink.erp.commodity.domain.TbCommodity;
import com.jeethink.erp.commodity.service.ITbCommodityService;

/**
 * 商品基本信息Service业务层处理
 * 
 * @author ypr
 * @date 2021-05-26
 */
@Service
public class TbCommodityServiceImpl implements ITbCommodityService 
{
    @Autowired
    private TbCommodityMapper tbCommodityMapper;

    /**
     * 查询商品基本信息
     * 
     * @param commodityId 商品基本信息ID
     * @return 商品基本信息
     */
    @Override
    public TbCommodity selectTbCommodityById(Long commodityId)
    {
        return tbCommodityMapper.selectTbCommodityById(commodityId);
    }

    /**
     * 查询商品基本信息列表
     * 
     * @param tbCommodity 商品基本信息
     * @return 商品基本信息
     */
    @Override
    public List<TbCommodity> selectTbCommodityList(TbCommodity tbCommodity)
    {
        return tbCommodityMapper.selectTbCommodityList(tbCommodity);
    }

    /**
     * 新增商品基本信息
     * 
     * @param tbCommodity 商品基本信息
     * @return 结果
     */
    @Override
    public int insertTbCommodity(TbCommodity tbCommodity)
    {
        tbCommodity.setCreateTime(DateUtils.getNowDate());
        return tbCommodityMapper.insertTbCommodity(tbCommodity);
    }

    /**
     * 修改商品基本信息
     * 
     * @param tbCommodity 商品基本信息
     * @return 结果
     */
    @Override
    public int updateTbCommodity(TbCommodity tbCommodity)
    {
        tbCommodity.setUpdateTime(DateUtils.getNowDate());
        return tbCommodityMapper.updateTbCommodity(tbCommodity);
    }

    /**
     * 批量删除商品基本信息
     * 
     * @param commodityIds 需要删除的商品基本信息ID
     * @return 结果
     */
    @Override
    public int deleteTbCommodityByIds(Long[] commodityIds)
    {
        return tbCommodityMapper.deleteTbCommodityByIds(commodityIds);
    }

    /**
     * 删除商品基本信息信息
     * 
     * @param commodityId 商品基本信息ID
     * @return 结果
     */
    @Override
    public int deleteTbCommodityById(Long commodityId)
    {
        return tbCommodityMapper.deleteTbCommodityById(commodityId);
    }

    @Override
    public List<TbCommodity> mineStock(TbCommodity tbCommodity) {
        return tbCommodityMapper.mineStock(tbCommodity);
    }

    @Override
    public List<TbCommodity> getMineStockList(TbCommodity tbCommodity) {
        return tbCommodityMapper.getMineStockList(tbCommodity);
    }

    @Override
    public List<TbCommodity> selectCommodityTypeList(Long[] commodityTypeIds) {
        return tbCommodityMapper.selectCommodityTypeList(commodityTypeIds);
    }
}
